package com.matt.controller.pad;

import com.matt.domain.AppSkin;
import com.matt.foundation.model.MemVerificationCache;
import com.matt.commons.model.StatusResponse;
import com.matt.commons.page.PagerQuery;
import com.matt.service.AppSkinService;
import com.matt.service.remoteCall.SsoCallService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.matt.foundation.constant.RequestConstant.TICKET;

@RestController
@RequestMapping("/pad/appSkin")
@Slf4j
public class PadAppSkinController {

    @Autowired
    private MemVerificationCache cache;

    @Autowired
    private SsoCallService ssoCallService;

    @Autowired
    private AppSkinService appSkinService;


    @RequestMapping("/page")
    public StatusResponse page(@RequestHeader(TICKET) String ticket, PagerQuery query){
        String areaId = cache.getAreaId(ticket);
        Page<AppSkin> recordPage = appSkinService.getPage(areaId,query.getPageNum(), query.getPageSize());
        return StatusResponse.success(recordPage);
    }
}
